// src-tauri/src/models.rs
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[derive(Serialize, Deserialize, Clone)]
pub struct Chapter {
    pub id: String,
    pub title: String,
    pub description: String,
    pub price: f64,      // 价格，0表示免费
    pub is_free: bool,   // 是否免费
    pub scripts: Vec<Script>,
    pub preview_content: String, // 预览内容
}

#[derive(Serialize, Deserialize, Clone)]
pub struct Script {
    pub id: String,
    pub filename: String,
    pub title: String,
    pub description: String,
    pub dependencies: Vec<String>, // 需要的Python库
}

#[derive(Serialize, Deserialize)]
pub struct UserData {
    pub purchased_chapters: Vec<String>, // 已购买的章节ID
    pub license_key: Option<String>,
    pub total_spent: f64,
}